.class Lcom/waiqin365/lightapp/im/adapter/ab;
.super Ljava/lang/Object;

# interfaces
.implements Landroid/view/View$OnClickListener;


# instance fields
.field final synthetic a:Lcom/hyphenate/chat/EMMessage;

.field final synthetic b:Lcom/waiqin365/lightapp/im/adapter/f;


# direct methods
.method constructor <init>(Lcom/waiqin365/lightapp/im/adapter/f;Lcom/hyphenate/chat/EMMessage;)V
    .locals 0

    iput-object p1, p0, Lcom/waiqin365/lightapp/im/adapter/ab;->b:Lcom/waiqin365/lightapp/im/adapter/f;

    iput-object p2, p0, Lcom/waiqin365/lightapp/im/adapter/ab;->a:Lcom/hyphenate/chat/EMMessage;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method


# virtual methods
.method public onClick(Landroid/view/View;)V
    .locals 10

    const/4 v3, 0x0

    new-instance v6, Ljava/util/ArrayList;

    invoke-direct {v6}, Ljava/util/ArrayList;-><init>()V

    move v2, v3

    move v4, v3

    move v5, v3

    :goto_0
    iget-object v0, p0, Lcom/waiqin365/lightapp/im/adapter/ab;->b:Lcom/waiqin365/lightapp/im/adapter/f;

    invoke-static {v0}, Lcom/waiqin365/lightapp/im/adapter/f;->c(Lcom/waiqin365/lightapp/im/adapter/f;)Lcom/hyphenate/chat/EMConversation;

    move-result-object v0

    invoke-virtual {v0}, Lcom/hyphenate/chat/EMConversation;->getAllMessages()Ljava/util/List;

    move-result-object v0

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v0

    if-ge v2, v0, :cond_2

    iget-object v0, p0, Lcom/waiqin365/lightapp/im/adapter/ab;->b:Lcom/waiqin365/lightapp/im/adapter/f;

    invoke-static {v0}, Lcom/waiqin365/lightapp/im/adapter/f;->c(Lcom/waiqin365/lightapp/im/adapter/f;)Lcom/hyphenate/chat/EMConversation;

    move-result-object v0

    invoke-virtual {v0}, Lcom/hyphenate/chat/EMConversation;->getAllMessages()Ljava/util/List;

    move-result-object v0

    invoke-interface {v0, v2}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/hyphenate/chat/EMMessage;

    invoke-virtual {v0}, Lcom/hyphenate/chat/EMMessage;->getType()Lcom/hyphenate/chat/EMMessage$Type;

    move-result-object v1

    sget-object v7, Lcom/hyphenate/chat/EMMessage$Type;->IMAGE:Lcom/hyphenate/chat/EMMessage$Type;

    if-ne v1, v7, :cond_4

    invoke-virtual {v0}, Lcom/hyphenate/chat/EMMessage;->getBody()Lcom/hyphenate/chat/EMMessageBody;

    move-result-object v1

    check-cast v1, Lcom/hyphenate/chat/EMImageMessageBody;

    invoke-virtual {v1}, Lcom/hyphenate/chat/EMImageMessageBody;->getLocalUrl()Ljava/lang/String;

    move-result-object v7

    iget-object v8, p0, Lcom/waiqin365/lightapp/im/adapter/ab;->a:Lcom/hyphenate/chat/EMMessage;

    invoke-virtual {v8}, Lcom/hyphenate/chat/EMMessage;->getMsgId()Ljava/lang/String;

    move-result-object v8

    invoke-virtual {v0}, Lcom/hyphenate/chat/EMMessage;->getMsgId()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v8, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_0

    move v5, v4

    :cond_0
    new-instance v0, Lcom/waiqin365/lightapp/im/domain/IMPhoto;

    invoke-direct {v0}, Lcom/waiqin365/lightapp/im/domain/IMPhoto;-><init>()V

    new-instance v8, Ljava/lang/StringBuilder;

    invoke-direct {v8}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {v8, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v8

    const-string/jumbo v9, ""

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    invoke-virtual {v8}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v8

    iput-object v8, v0, Lcom/waiqin365/lightapp/im/domain/IMPhoto;->a:Ljava/lang/String;

    invoke-static {v7}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v8

    if-nez v8, :cond_1

    new-instance v8, Ljava/io/File;

    invoke-direct {v8, v7}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    invoke-virtual {v8}, Ljava/io/File;->exists()Z

    move-result v8

    if-eqz v8, :cond_1

    iput-object v7, v0, Lcom/waiqin365/lightapp/im/domain/IMPhoto;->b:Ljava/lang/String;

    :goto_1
    add-int/lit8 v1, v4, 0x1

    invoke-virtual {v6, v0}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    move v4, v5

    :goto_2
    add-int/lit8 v0, v2, 0x1

    move v2, v0

    move v5, v4

    move v4, v1

    goto :goto_0

    :cond_1
    invoke-virtual {v1}, Lcom/hyphenate/chat/EMImageMessageBody;->getRemoteUrl()Ljava/lang/String;

    move-result-object v1

    iput-object v1, v0, Lcom/waiqin365/lightapp/im/domain/IMPhoto;->e:Ljava/lang/String;

    goto :goto_1

    :cond_2
    new-instance v1, Landroid/content/Intent;

    iget-object v0, p0, Lcom/waiqin365/lightapp/im/adapter/ab;->b:Lcom/waiqin365/lightapp/im/adapter/f;

    invoke-static {v0}, Lcom/waiqin365/lightapp/im/adapter/f;->b(Lcom/waiqin365/lightapp/im/adapter/f;)Landroid/app/Activity;

    move-result-object v0

    const-class v2, Lcom/waiqin365/lightapp/im/activity/ImPhotoListActivity;

    invoke-direct {v1, v0, v2}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V

    const-string/jumbo v0, "imPhotos"

    invoke-virtual {v1, v0, v6}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/io/Serializable;)Landroid/content/Intent;

    const-string/jumbo v0, "currentPage"

    invoke-virtual {v1, v0, v5}, Landroid/content/Intent;->putExtra(Ljava/lang/String;I)Landroid/content/Intent;

    iget-object v0, p0, Lcom/waiqin365/lightapp/im/adapter/ab;->a:Lcom/hyphenate/chat/EMMessage;

    if-eqz v0, :cond_3

    iget-object v0, p0, Lcom/waiqin365/lightapp/im/adapter/ab;->a:Lcom/hyphenate/chat/EMMessage;

    invoke-virtual {v0}, Lcom/hyphenate/chat/EMMessage;->direct()Lcom/hyphenate/chat/EMMessage$Direct;

    move-result-object v0

    sget-object v2, Lcom/hyphenate/chat/EMMessage$Direct;->RECEIVE:Lcom/hyphenate/chat/EMMessage$Direct;

    if-ne v0, v2, :cond_3

    iget-object v0, p0, Lcom/waiqin365/lightapp/im/adapter/ab;->a:Lcom/hyphenate/chat/EMMessage;

    invoke-virtual {v0}, Lcom/hyphenate/chat/EMMessage;->isAcked()Z

    move-result v0

    if-nez v0, :cond_3

    iget-object v0, p0, Lcom/waiqin365/lightapp/im/adapter/ab;->a:Lcom/hyphenate/chat/EMMessage;

    invoke-virtual {v0}, Lcom/hyphenate/chat/EMMessage;->getChatType()Lcom/hyphenate/chat/EMMessage$ChatType;

    move-result-object v0

    sget-object v2, Lcom/hyphenate/chat/EMMessage$ChatType;->GroupChat:Lcom/hyphenate/chat/EMMessage$ChatType;

    if-eq v0, v2, :cond_3

    :try_start_0
    invoke-static {}, Lcom/hyphenate/chat/EMClient;->getInstance()Lcom/hyphenate/chat/EMClient;

    move-result-object v0

    invoke-virtual {v0}, Lcom/hyphenate/chat/EMClient;->chatManager()Lcom/hyphenate/chat/EMChatManager;

    move-result-object v0

    iget-object v2, p0, Lcom/waiqin365/lightapp/im/adapter/ab;->a:Lcom/hyphenate/chat/EMMessage;

    invoke-virtual {v2}, Lcom/hyphenate/chat/EMMessage;->getFrom()Ljava/lang/String;

    move-result-object v2

    iget-object v4, p0, Lcom/waiqin365/lightapp/im/adapter/ab;->a:Lcom/hyphenate/chat/EMMessage;

    invoke-virtual {v4}, Lcom/hyphenate/chat/EMMessage;->getMsgId()Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v0, v2, v4}, Lcom/hyphenate/chat/EMChatManager;->ackMessageRead(Ljava/lang/String;Ljava/lang/String;)V

    iget-object v0, p0, Lcom/waiqin365/lightapp/im/adapter/ab;->a:Lcom/hyphenate/chat/EMMessage;

    const/4 v2, 0x1

    invoke-virtual {v0, v2}, Lcom/hyphenate/chat/EMMessage;->setAcked(Z)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    :cond_3
    :goto_3
    iget-object v0, p0, Lcom/waiqin365/lightapp/im/adapter/ab;->b:Lcom/waiqin365/lightapp/im/adapter/f;

    invoke-static {v0}, Lcom/waiqin365/lightapp/im/adapter/f;->a(Lcom/waiqin365/lightapp/im/adapter/f;)Landroid/content/Context;

    move-result-object v0

    check-cast v0, Lcom/waiqin365/lightapp/im/activity/CustomServiceChatActivity;

    iput-boolean v3, v0, Lcom/waiqin365/lightapp/im/activity/CustomServiceChatActivity;->e:Z

    iget-object v0, p0, Lcom/waiqin365/lightapp/im/adapter/ab;->b:Lcom/waiqin365/lightapp/im/adapter/f;

    invoke-static {v0}, Lcom/waiqin365/lightapp/im/adapter/f;->b(Lcom/waiqin365/lightapp/im/adapter/f;)Landroid/app/Activity;

    move-result-object v0

    invoke-virtual {v0, v1}, Landroid/app/Activity;->startActivity(Landroid/content/Intent;)V

    iget-object v0, p0, Lcom/waiqin365/lightapp/im/adapter/ab;->b:Lcom/waiqin365/lightapp/im/adapter/f;

    invoke-static {v0}, Lcom/waiqin365/lightapp/im/adapter/f;->b(Lcom/waiqin365/lightapp/im/adapter/f;)Landroid/app/Activity;

    move-result-object v0

    const v1, 0x7f040027

    invoke-virtual {v0, v1, v3}, Landroid/app/Activity;->overridePendingTransition(II)V

    return-void

    :catch_0
    move-exception v0

    invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V

    goto :goto_3

    :cond_4
    move v1, v4

    move v4, v5

    goto/16 :goto_2
.end method
